<?php
	
	require_once(ROOTDIR.'source/service/class/class.main.php');
	
	class _WeiXin extends Main
	{
	
		private static $weixin = 'weixin_ticket';
		
		public static function addWeiXin_Info($data)
		{
			$set = join(',',self::setMySQLParam($data));
			if(!empty($set))
			{
				$sql = sprintf("insert into %s set %s ",self::$weixin,$set);
				fileLog($sql);
				return self::getMysqlInstance()->insert_sql($sql);
			}
			else
			{
				return false;
			}
		}
		
		public static function setWeiXin_Info($where,$data)
		{
			$set = join(',',self::setMySQLParam($data));
			if(!empty($set) && !empty($where['id']))
			{
				$sql = sprintf("update %s set %s where id='%s'",self::$weixin,$set,$where['id']);
				fileLog($sql);
				return self::getMysqlInstance()->diy_update_sql($sql);
			}
			else
			{
				return false;
			}
		}
		
		public static function getWeiXin_Info($wheres)
		{
			$where = join(' and ',self::setMySQLParam($wheres));
			$sql = sprintf("select * from %s where %s",self::$weixin,$where);
			fileLog($sql);
			$res = self::getMysqlInstance()->query($sql);
			
			return $res[0];
		}
	}